package com.example.holes;

import com.example.holes.R;

import android.os.Bundle;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.view.Display;
import android.view.Menu;
import android.view.View;
import android.view.WindowManager;
import android.widget.Toast;

/*
 * Temporary Main Menu
 */
public class MainActivity extends Activity {
	
	@Override
    public void onCreate(Bundle savedInstanceState) {
		// load saved data
		SharedPreferences prefs = this.getSharedPreferences(
			      "com.example.holes", Context.MODE_PRIVATE);
		GameState.coins = prefs.getInt("coins", 0);
		
    	// store devices width x height
    	storeDeviceDimensions();
    	
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        getMenuInflater().inflate(R.menu.activity_main, menu);
        return true;
    }
    
    public void launchLevelSelectActivity(View view) {
    	Intent intent = new Intent(this, LevelSelectActivity.class);
        startActivityForResult(intent, 1); // get score
    }
    
    public void storeDeviceDimensions(){
    	Display display = getWindowManager().getDefaultDisplay();
    	Global.WIDTH = display.getWidth();
    	Global.HEIGHT = display.getHeight();
    	Global.SCALE_RATIO_W = (float)Global.WIDTH / Global.ORIG_WIDTH;
    	Global.SCALE_RATIO_H = (float)Global.HEIGHT / Global.ORIG_HEIGHT;
    }
}
